package string;

import java.util.Objects;

public class Point {
    int x;
    int y;

    public Point() {}
    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }
    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public void setX(int x) {
        this.x = x;
    }

    public void setY(int y) {
        this.y = y;
    }

    @Override
    public String toString() {
        return "Point{" +
                "x=" + x +
                ", y=" + y +
                '}';
    }
    public boolean equals(Object obj) {
        if (obj ==null) return true; {
             if (!(obj instanceof Point)) {
                 return false;
             }
             Point p = (Point) obj;
             return this.x == p.x && this.y == p.y;
        }
    }
    @Override
    public int hashCode() {
        return Objects.hash(x, y);
    }

    public static void main(String[] args) {
        Point p1 = new Point(100,200);
        Point p2 = new Point(100,200);
        System.out.println(p1==p2);
        System.out.println(p1.equals(p2));

    }

}
